% I_data=all_rb_1(all_rb_1(:,9)>=10 & ...
% all_rb_1(:,9)<=12 & all_rb_1(:,3)>1d37,19);
% I_data=all_rb_1(all_rb_1(:,9)==1  & all_rb_1(:,3)>1d37,19);
I_data=all_rb_1(all_rb_1(:,9)==1 & all_rb_1(:,11)<3 & all_rb_1(:,3)>1d39,19);
% I_data=all_wind_1(all_wind_1(:,9)==1 ,19);
% I_data=all_rb_1(all_rb_1(:,9)==1);
Msun=1.9891d30;
yearsc=3.1557d+07;
m_tr=1d-5;
Lx=(0.1*(3.0d8)^2*Msun*1d7*m_tr/yearsc);
filefolder=['DataGedianz0.01_',label,'/'];
% filefolderbpp='DataGedianz0.01_2bpp\';
e=2.71828;
I_UNI=unique(I_data)';
Tmax=200;

PLOT_Tmax=0;


for i = I_UNI(floor(rand().*length(I_UNI)))
    % for i=14632
    % for i=ceil(rand()*1.5d5)
    Binary=importdata([filefolder,num2str(i),'.out']);
    %     xlim([0 Tmax])
    if(PLOT_Tmax~=1)
        Binary=Binary(Binary(:,16)>1d-8 & max(Binary(:,2),Binary(:,3))>12 ,:);
    end
    subplot 321
    plot(Binary(:,1),Binary(:,2))
    hold on
    plot(Binary(:,1),Binary(:,3))
    %     xlim([0 Tmax])
    title('kw')
    hold off
    
    subplot 322
    plot(Binary(:,1),Binary(:,4))
    hold on
    plot(Binary(:,1),Binary(:,5))
    %     xlim([0 Tmax])
    ylabel('mass/solar mass')
    hold off
    
    subplot 323
%     Binary(abs(Binary(:,16))>1d-5,:)=[];
%     Binary(abs(Binary(:,17))>1d-5,:)=[];
    plot(Binary(:,1),log10(abs(Binary(:,16))))
    hold on
    plot(Binary(:,1),log10(abs(Binary(:,17))))
    %     xlim([0 Tmax])
    title('M_{tr}')
    hold off
    
    subplot 324
    plot(Binary(:,1),log10((Binary(:,18))))
    %     xlim([0 Tmax])
    hold on
    plot(Binary(:,1),Binary(:,8))
    plot(Binary(:,1),Binary(:,9))
    %     xlim([0 Tmax])
    legend('log10(separation)','log10(R1)','log10(R2)')
    hold off
    subplot 325
    plot(Binary(:,1),((Binary(:,19))))
    %     xlim([0 Tmax])
    fprintf('              TIME   M1        M2    K1 K2        SEP    ECC R1/ROL1 R2/ROL2  TYPE')
    a=(importdata([filefolder,num2str(i),'bpp.out']))
    %     a={{'TIME','M1','M2','K1',' K2','SEP','ECC','R1/ROL1 ','R2/ROL2','TYPE'};a}
    %     a={'    TIME      M1       M2   K1 K2        SEP    ECC R1/ROL1 R2/ROL2  TYPE';a(:)}
    
    subplot 326
    plot(Binary(:,1),Binary(:,19))
    
    for ii=1:6
        subplot(3,2,ii)
        if(PLOT_Tmax==1)
            xlim([0 Tmax])
        end
    end
end